using System;
using Microsoft.SPOT;
using dotnetwarrior.NetMF.DL40;
using System.Threading;

namespace DLIOTest
{
  class TestInterruptPin
  {
    static DLIOModule Module;
    static IInterruptPin InterruptPin;
    static IOutputPin LedPin;

    public static void Run(DLIOModule module)
    {
      Module = module;
      LedPin = Module.CreateOutputPin(2, 3, false);
      InterruptPin = Module.CreateInterruptPin(3, 1, Microsoft.SPOT.Hardware.Port.ResistorMode.Disabled, Microsoft.SPOT.Hardware.Port.InterruptMode.InterruptEdgeLevelHigh);
      InterruptPin.Interrupt += new PinInterruptHandler(Pin_Interrupt);      
    }

    static void Pin_Interrupt(IInterruptPin pin, uint interruptCount)
    {
      Debug.Print("Button pressed");
      LedPin.Write(!LedPin.Read());
    }

  }
}
